package edu.hhu.wifispark;

import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class LogUtil {
	public static String nowDate(){
		Date now = new Date();
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return formatter.format(now);
	}
	public static void log(String msg){
		String time = nowDate();
		FileWriter writer;
		try {
			writer = new FileWriter("logs", true);
	        writer.write(time+"\t"+msg+"\r\n");
	        writer.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
